<script>
	export default {
		onLaunch: function() {
			this.Auth();
			this.getConfig();
			let hctime = uni.getStorageSync('hctime');
			if(hctime == null || hctime == undefined || hctime <= new Date().getTime()){
				uni.setStorageSync('hctime',new Date().getTime() + 10000);
				window.location.reload(); // 强制刷新页面
			}
			console.log('App Launch')
			
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}, 
		methods: {
			Auth(){//初始化用户信息
				var token = '';
				var uid = 0;
				if(uni.getStorageSync('token')){
					token = uni.getStorageSync('token');
					uid = uni.getStorageSync('uid');
				}
				this.$api.sendRequest({
					data:{
						service:'Auth.oauth2',
						uid:uid,
						token:token,
					},
					success: res => {
						if(res.data.code == 0){
							var param = res.data.info[0];
							uni.setStorageSync('token',param['token']);
							uni.setStorageSync('uid',param['uid']);
						}
					}
				});
			},
			getConfig(){//获取配置信息
				var token = '';
				var uid = 0;
				if(uni.getStorageSync('token')){
					token = uni.getStorageSync('token');
					uid = uni.getStorageSync('uid');
				}
				this.$api.sendRequest({
					data:{
						service:'Home.getConfig',
						uid:uid,
						token:token,
					},
					success: res => {
						if(res.data.code == 0){
							var param = res.data.info[0];
							uni.setStorageSync('config',param);
						}
					}
				});
			}
		}
	}
</script>

<style>
	/*每个页面公共css */
	/* 隐藏滚动条 */
	::-webkit-scrollbar {
	    display: none;
	    width: 0 !important;
	    height: 0 !important;
	    -webkit-appearance: none;
	    background: transparent;
	    color: transparent;
	  }
	  .uni-modal .uni-modal__bd,.uni-modal__title{
	       color: #000000;
	  }
</style>
